home *** CD-ROM | disk | FTP | other *** search
- unit Jack1;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls;
-
- type
- TForm1 = class(TForm)
- Edit1: TEdit;
- Button1: TButton;
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.Button1Click(Sender: TObject);
- var { declare 2 integger variables }
- oldnum,
- newnum : integer;
- { begin code section }
- begin
- { initialise oldnum to integer shown in the caption of this form }
- oldnum := StrToInt( Caption );
- newnum := oldnum + 1;
- { on 10th click of the button, Jackpot! }
- if newnum = 10 then
- begin
- Edit1.Text := 'Jackpot!';
- Color := clRed;
- Caption := IntToStr( 0 );
- end
- { all other clicks, you lose }
- else
- begin
- Caption := IntToStr( newnum );
- Edit1.Text := '';
- Color := clBtnFace;
- end;
- end;
-
- end.
-